package values.quest
{
import flash.utils.Dictionary;

public class QuestSettingValue
{
	private static var _handlers:*;

	public function get handlers():*
	{
		return _handlers;
	}
	
	[Data(type="field", mapping="handlers.handler")]
	public function set handlers(value:*):void
	{
		_handlers = value;
	}
	
	public static function get questHandlers():*
	{
		return _handlers;
	}
	
	private static var _triggers:*;

	public function get triggers():*
	{
		return _triggers;
	}
	
	[Data(type="field", mapping="triggers.trigger")]
	public function set triggers(value:*):void
	{
		_triggers = value;
	}
	
	public static function get questTriggers():*
	{
		return _triggers;
	}
	
	private static var _groups:Dictionary;
	
	public function get groups():Dictionary
	{
		return _groups;
	}
	
	[Data(type="mapping", 
		  mapping="groups.group", 
		  ref="values.quest.QuestGroupTemplateValue",
		  way="one_to_more",
		  object="flash.utils.Dictionary",
          key="@key",
          preHandler="setGroupForQuestTemplate")]
	public function set groups(value:Dictionary):void
	{
		_groups = value;
	}
	
	public static function get questGroups():Dictionary
	{
		return _groups;
	}
	
	public function setGroupForQuestTemplate(group:QuestGroupTemplateValue):void		
	{
		var template:QuestTemplateValue
		for each (var questKey:String in group.quests)
		{
			template = QuestTemplateValueList.getByKey(questKey);
			template.group = group;
		}
	}
	
	private static var uiAssetsDef:*;

	public function get uiAssets():*
	{
		return uiAssetsDef;
	}
	
	[Data(type="field", mapping="ui_assets.asset")]
	public function set uiAssets(value:*):void
	{
		uiAssetsDef = value;
	}
	
	public static function getUIDefByKey(key:String):*
	{
		return uiAssetsDef.(@key == key);
	}
	
}
}



